

#ifndef __CORTISOL_GLSHADER_H
#define __CORTISOL_GLSHADER_H

#include "Object.h"

#include <GL/GL.h>
#include <wgl/glext.h>


class GLShader
	:	public virtual Object {

public:

	GLShader(GLenum shaderType, const GLchar* shaderSrc) 
		:	shaderType(shaderType) {

		Initialise(shaderSrc);
	}

	virtual ~GLShader() {

		Dispose();
	}

	GLuint GetShader() const {

		return shader;
	}

private:

	GLuint shader;

	const GLenum shaderType;

	void Initialise(const GLchar* src) {

		GLsizei size = strlen(src);
		shader = glCreateShader(shaderType);
		glShaderSource(shader,1,&src,&size);
		glCompileShader(shader);
	}

	void Dispose(void) {

		glDeleteShader( shader);
	}
};

#endif /*** __CORTISOL_GLSHADER_H ***/

